You are here: Symbol Reference > Dew Namespace > Dew.Math Namespace > Classes > TMtxExpression Class > TMtxExpression Methods > TMtxExpression.DefineComplex Method
Dew Math for .NET
ContentsIndexHome
PreviousUpNext
TMtxExpression.DefineComplex Method

Defines new complex variable.

Syntax
C#
Visual Basic
public TComplexValue DefineComplex([In] string AVarName);

If variable with name AVarName already was definded, it will be redefined and all expressions which contain the symbol AVarName will be recompiled before the next evaluation.

Use parser to evaluate the "(2*i*z)" formula where z=-2+3*i.

using Dew.Math; using Dew.Math.Units; namespace Dew.Examples() { void Example() { // 1. Define variables TComplexValue z = MyParser.DefineComplex("z"); // 2. Set values z.ComplexValue = Math387.Cplx(-2,3); // 3. Add formula and evaluate, MyParser.AddExpr("2*i*z"); TCplx res = MyParser.EvaluateComplex(); // res = -6-4*i } }
Copyright (c) 1999-2024 by Dew Research. All rights reserved.
What do you think about this topic? Send feedback!